/**
 * @Date: Mar 3, 2010 11:53:11 AM
 */
package com.philip.journal.core.exception;

/**
 * Custom exception wrapper.
 *
 * @author cry30
 */
public class JournalException extends RuntimeException {

    /** Short description of this exception. */
    private String shortDesc;

    /** Long description of this exception. This can includes stack trace. */
    private String longDesc;

    /**
     * RTFC.
     *
     * @param pShortDesc initial short description.
     * @param pLongDesc initial long description.
     * @param pMessage parameter to {@link #JournalException(String, Throwable)} constructor.
     * @param throwable parameter to {@link #JournalException(String, Throwable)} constructor..
     */
    public JournalException(final String pShortDesc, final String pLongDesc, final String pMessage,
            final Throwable throwable) {
        this(pMessage, throwable);
        this.shortDesc = pShortDesc;
        this.longDesc = pLongDesc;
    }

    /**
     * RTFC.
     *
     * @param pShortDesc initial short description.
     * @param pLongDesc initial long description.
     * @param pMessage parameter to {@link #JournalException(String)} constructor.
     */
    public JournalException(final String pShortDesc, final String pLongDesc, final String pMessage) {
        this(pMessage);
        this.shortDesc = pShortDesc;
        this.longDesc = pLongDesc;
    }


    /**
     * RTFC.
     *
     * @param pMessage parameter to super {@link #Exception(String)}
     */
    public JournalException(final String pMessage) {
        super(pMessage);
    }

    /**
     * RTFC.
     *
     * @param pMessage parameter to super {@link #Exception(String, Throwable)}
     * @param pThrowable parameter to super {@link #Exception(String, Throwable)}
     */
    public JournalException(final String pMessage, final Throwable pThrowable) {
        super(pMessage, pThrowable);
    }

    /**
     * Trial method inspired by OAF.
     *
     * @param exception Exception to wrap.
     * @return wrapper application specific Exception.
     */
    public static JournalException wrapperException(final Exception exception)
    {
        return new JournalException(exception.getMessage(), exception);
    }

    /**
     * @return {@link #shortDesc}
     */
    public String getShortDesc() {
        return shortDesc;
    }

    /**
     * @param pShortDesc new {@link #shortDesc} to set.
     */
    public void setShortDesc(final String pShortDesc) {
        this.shortDesc = pShortDesc;
    }

    /**
     * @return {@link #longDesc}
     */
    public String getLongDesc() {
        return longDesc;
    }

    /**
     * Accessor method for {@link #longDesc}.
     *
     * @param pLongDesc {@link #longDesc}
     */
    public final void setLongDesc(final String pLongDesc) {
        this.longDesc = pLongDesc;
    }
}
